import request from '@/utils/request';

//保存 添加任务
export function saveTaskInfo(data: anyObj): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/reportTaskInfo/saveTaskInfo',
		method: 'post',
		data: data,
		headers: {
			VERSION: 'LSH',
		},
	});
}

//删除任务
export function deleteTaskByIds(ids: any): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/reportTaskInfo/deleteTaskByIds/' + ids,
		method: 'delete',
		headers: {
			VERSION: 'LSH',
		},
	});
}

//根据任务id查询任务详情信息
export function getTaskInfoById(id: any): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/reportTaskInfo/getTaskInfoById/' + id,
		method: 'get',
		headers: {
			VERSION: 'LSH',
		},
	});
}

// 分页查询-任务信息
export function getTaskInfoList(data: anyObj): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/reportTaskInfo/getTaskInfoList',
		method: 'post',
		data: data,
		headers: {
			VERSION: 'LSH',
		},
	});
}

// 启动任务
export function startTaskByIds(ids: any): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/reportTaskInfo/startTaskByIds/' + ids,
		method: 'put',
		data: ids,
		headers: {
			VERSION: 'LSH',
		},
	});
}

// 暂停任务
export function stopTaskByIds(ids: any): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/reportTaskInfo/stopTaskByIds/' + ids,
		method: 'put',
		data: ids,
	});
}

// 修改-更新任务
export function updateTaskInfo(data: anyObj): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/reportTaskInfo/updateTaskInfo',
		method: 'post',
		data: data,
		headers: {
			VERSION: 'LSH',
		},
	});
}

// 获取 选择模板
export function excelQuery(data?: anyObj): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/customExport/excelQuery',
		method: 'get',
		data: data,
		headers: {
			VERSION: 'lsl',
		},
	});
}

// 获取执行频率 - 表达式设置
export function getCronList(data?: anyObj): ApiPromise<ApiResponse> {
	return request({
		url: '/jimu/reportTaskInfo/getCronList',
		method: 'get',
		data: data,
		headers: {
			VERSION: 'LSH',
		},
	});
}
